package com.study.mapper;

import com.study.entity.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminMapper {
    /**
     * 添加管理员
     * @param admin
     */
    @Insert("insert into administrators (username, password, name, phone, sex, id_number, status, user_type, avatar, " +
            "create_time, create_user, remark) " +
            "values (#{username},#{password},#{name}, #{phone}, #{sex}, #{idNumber}, #{status}, #{userType}, #{avatar}," +
            "#{createTime},  #{createUser}, #{remark})")
    void add(Admin admin);

    /**
     * 根据用户名查询管理员
     * @param username
     * @return
     */
    @Select("select * from administrators where username = #{username};")
    Admin getByUsername(String username);
}
